package com.qiangesoft.blog.controller.web;

import com.qiangesoft.blog.core.pojo.vo.BlogCategorySimpleVO;
import com.qiangesoft.blog.core.pojo.vo.BlogCategoryTreeVO;
import com.qiangesoft.blog.core.service.IBlogCategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 博客分类 前端控制器
 * </p>
 *
 * @author qiange
 * @date 2023-06-01
 */
@RestController
@RequestMapping("/api/category")
@RequiredArgsConstructor
@Api(tags = "分类管理")
public class ApiBlogCategoryController {

    private final IBlogCategoryService blogCategoryService;

    @GetMapping
    @ApiOperation(value = "分类列表")
    public List<BlogCategorySimpleVO> list() {
        return blogCategoryService.listAll();
    }

    @GetMapping("/tree")
    @ApiOperation(value = "分类树")
    public List<BlogCategoryTreeVO> listTree() {
        return blogCategoryService.listTree();
    }

}

